package jsu.lh.homework.service;

import jsu.lh.homework.bean.User;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.Map;

@Service
public class UserService {
    private Map <String,Object> userMap = new HashMap<>();


    public void addUser(String username, String password) {
        userMap.put(username, password);
    }

    public void deleteUser(String username) {
        if(userMap.containsKey(username)) {
            userMap.remove(username);
        }
    }

    public void updateUser(String username, String password) {
        userMap.put(username, password);
    }

    public User getUser(String username) {
        return (User) userMap.get(username);
    }
}
